﻿using System;

namespace Ast.Core.Services.Extensions
{
    public static class ObjectTypeServiceExtensions
    {
        public static string GetObjectNameByType(this IObjectTypeService objectTypeService, IntPtr objPtr, ObjectTypeData objectTypeData)
        {
            // file object
            if (objectTypeData.Name.Equals("file", StringComparison.InvariantCultureIgnoreCase))
            {
                return objectTypeService.GetFileObjectName(objPtr);
            }

            // key object
            if (objectTypeData.Name.Equals("key", StringComparison.InvariantCultureIgnoreCase))
            {
                return objectTypeService.GetKeyObjectName(objPtr);
            }

            // default
            return objectTypeService.GetObjectName(objPtr);
        }
    }
}